<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Gamma (Commons Math 3.2 API)
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="Gamma (Commons Math 3.2 API)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Gamma.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/commons/math3/special/Erf.html" title="class in org.apache.commons.math3.special"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html?org/apache/commons/math3/special/Gamma.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Gamma.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.commons.math3.special</FONT>
<BR>
Class Gamma</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
  <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.commons.math3.special.Gamma</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Gamma</B><DT>extends <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>

<P>
<p>
 This is a utility class that provides computation methods related to the
 &Gamma; (Gamma) family of functions.
 </p>
 <p>
 Implementation of <A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#invGamma1pm1(double)"><CODE>invGamma1pm1(double)</CODE></A> and
 <A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#logGamma1p(double)"><CODE>logGamma1p(double)</CODE></A> is based on the algorithms described in
 <ul>
 <li><a href="http://dx.doi.org/10.1145/22721.23109">Didonato and Morris
 (1986)</a>, <em>Computation of the Incomplete Gamma Function Ratios and
     their Inverse</em>, TOMS 12(4), 377-393,</li>
 <li><a href="http://dx.doi.org/10.1145/131766.131776">Didonato and Morris
 (1992)</a>, <em>Algorithm 708: Significant Digit Computation of the
     Incomplete Beta Function Ratios</em>, TOMS 18(3), 360-373,</li>
 </ul>
 and implemented in the
 <a href="http://www.dtic.mil/docs/citations/ADA476840">NSWC Library of Mathematical Functions</a>,
 available
 <a href="http://www.ualberta.ca/CNS/RESEARCH/Software/NumericalNSWC/site.html">here</a>.
 This library is "approved for public release", and the
 <a href="http://www.dtic.mil/dtic/pdf/announcements/CopyrightGuidance.pdf">Copyright guidance</a>
 indicates that unless otherwise stated in the code, all FORTRAN functions in
 this library are license free. Since no such notice appears in the code these
 functions can safely be ported to Commons-Math.
 </p>
<P>

<P>
<DL>
<DT><B>Version:</B></DT>
  <DD>$Id: Gamma.java 1422313 2012-12-15 18:53:41Z psteitz $</DD>
</DL>
<HR>

<P>
<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#GAMMA">GAMMA</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://en.wikipedia.org/wiki/Euler-Mascheroni_constant">Euler-Mascheroni constant</a></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#LANCZOS_G">LANCZOS_G</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The value of the <code>g</code> constant in the Lanczos approximation, see
 <A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#lanczos(double)"><CODE>lanczos(double)</CODE></A>.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#digamma(double)">digamma</A></B>(double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computes the digamma function of x.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#gamma(double)">gamma</A></B>(double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the value of Γ(x).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#invGamma1pm1(double)">invGamma1pm1</A></B>(double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the value of 1 / &Gamma;(1 + x) - 1 for -0&#46;5 &le; x &le;
 1&#46;5.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#lanczos(double)">lanczos</A></B>(double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Returns the Lanczos approximation used to compute the gamma function.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#logGamma(double)">logGamma</A></B>(double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Returns the value of log&nbsp;&Gamma;(x) for x&nbsp;&gt;&nbsp;0.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#logGamma1p(double)">logGamma1p</A></B>(double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the value of log &Gamma;(1 + x) for -0&#46;5 &le; x &le; 1&#46;5.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#regularizedGammaP(double, double)">regularizedGammaP</A></B>(double&nbsp;a,
                  double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the regularized gamma function P(a, x).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#regularizedGammaP(double, double, double, int)">regularizedGammaP</A></B>(double&nbsp;a,
                  double&nbsp;x,
                  double&nbsp;epsilon,
                  int&nbsp;maxIterations)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the regularized gamma function P(a, x).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#regularizedGammaQ(double, double)">regularizedGammaQ</A></B>(double&nbsp;a,
                  double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the regularized gamma function Q(a, x) = 1 - P(a, x).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#regularizedGammaQ(double, double, double, int)">regularizedGammaQ</A></B>(double&nbsp;a,
                  double&nbsp;x,
                  double&nbsp;epsilon,
                  int&nbsp;maxIterations)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the regularized gamma function Q(a, x) = 1 - P(a, x).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#trigamma(double)">trigamma</A></B>(double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computes the trigamma function of x.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->

<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="GAMMA"><!-- --></A><H3>
GAMMA</H3>
<PRE>
public static final double <B>GAMMA</B></PRE>
<DL>
<DD><a href="http://en.wikipedia.org/wiki/Euler-Mascheroni_constant">Euler-Mascheroni constant</a>
<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>2.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.commons.math3.special.Gamma.GAMMA">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="LANCZOS_G"><!-- --></A><H3>
LANCZOS_G</H3>
<PRE>
public static final double <B>LANCZOS_G</B></PRE>
<DL>
<DD>The value of the <code>g</code> constant in the Lanczos approximation, see
 <A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#lanczos(double)"><CODE>lanczos(double)</CODE></A>.
<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>3.1</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.commons.math3.special.Gamma.LANCZOS_G">Constant Field Values</A></DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="logGamma(double)"><!-- --></A><H3>
logGamma</H3>
<PRE>
public static double <B>logGamma</B>(double&nbsp;x)</PRE>
<DL>
<DD><p>
 Returns the value of log&nbsp;&Gamma;(x) for x&nbsp;&gt;&nbsp;0.
 </p>
 <p>
 For x &le; 8, the implementation is based on the double precision
 implementation in the <em>NSWC Library of Mathematics Subroutines</em>,
 <code>DGAMLN</code>. For x &gt; 8, the implementation is based on
 </p>
 <ul>
 <li><a href="http://mathworld.wolfram.com/GammaFunction.html">Gamma
     Function</a>, equation (28).</li>
 <li><a href="http://mathworld.wolfram.com/LanczosApproximation.html">
     Lanczos Approximation</a>, equations (1) through (5).</li>
 <li><a href="http://my.fit.edu/~gabdo/gamma.txt">Paul Godfrey, A note on
     the computation of the convergent Lanczos complex Gamma
     approximation</a></li>
 </ul>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - Argument.
<DT><B>Returns:</B><DD>the value of <code>log(Gamma(x))</code>, <code>Double.NaN</code> if
 <code>x &lt;= 0.0</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="regularizedGammaP(double, double)"><!-- --></A><H3>
regularizedGammaP</H3>
<PRE>
public static double <B>regularizedGammaP</B>(double&nbsp;a,
                                       double&nbsp;x)</PRE>
<DL>
<DD>Returns the regularized gamma function P(a, x).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>a</CODE> - Parameter.<DD><CODE>x</CODE> - Value.
<DT><B>Returns:</B><DD>the regularized gamma function P(a, x).
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/MaxCountExceededException.html" title="class in org.apache.commons.math3.exception">MaxCountExceededException</A></CODE> - if the algorithm fails to converge.</DL>
</DD>
</DL>
<HR>

<A NAME="regularizedGammaP(double, double, double, int)"><!-- --></A><H3>
regularizedGammaP</H3>
<PRE>
public static double <B>regularizedGammaP</B>(double&nbsp;a,
                                       double&nbsp;x,
                                       double&nbsp;epsilon,
                                       int&nbsp;maxIterations)</PRE>
<DL>
<DD>Returns the regularized gamma function P(a, x).

 The implementation of this method is based on:
 <ul>
  <li>
   <a href="http://mathworld.wolfram.com/RegularizedGammaFunction.html">
   Regularized Gamma Function</a>, equation (1)
  </li>
  <li>
   <a href="http://mathworld.wolfram.com/IncompleteGammaFunction.html">
   Incomplete Gamma Function</a>, equation (4).
  </li>
  <li>
   <a href="http://mathworld.wolfram.com/ConfluentHypergeometricFunctionoftheFirstKind.html">
   Confluent Hypergeometric Function of the First Kind</a>, equation (1).
  </li>
 </ul>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>a</CODE> - the a parameter.<DD><CODE>x</CODE> - the value.<DD><CODE>epsilon</CODE> - When the absolute value of the nth item in the
 series is less than epsilon the approximation ceases to calculate
 further elements in the series.<DD><CODE>maxIterations</CODE> - Maximum number of "iterations" to complete.
<DT><B>Returns:</B><DD>the regularized gamma function P(a, x)
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/MaxCountExceededException.html" title="class in org.apache.commons.math3.exception">MaxCountExceededException</A></CODE> - if the algorithm fails to converge.</DL>
</DD>
</DL>
<HR>

<A NAME="regularizedGammaQ(double, double)"><!-- --></A><H3>
regularizedGammaQ</H3>
<PRE>
public static double <B>regularizedGammaQ</B>(double&nbsp;a,
                                       double&nbsp;x)</PRE>
<DL>
<DD>Returns the regularized gamma function Q(a, x) = 1 - P(a, x).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>a</CODE> - the a parameter.<DD><CODE>x</CODE> - the value.
<DT><B>Returns:</B><DD>the regularized gamma function Q(a, x)
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/MaxCountExceededException.html" title="class in org.apache.commons.math3.exception">MaxCountExceededException</A></CODE> - if the algorithm fails to converge.</DL>
</DD>
</DL>
<HR>

<A NAME="regularizedGammaQ(double, double, double, int)"><!-- --></A><H3>
regularizedGammaQ</H3>
<PRE>
public static double <B>regularizedGammaQ</B>(double&nbsp;a,
                                       double&nbsp;x,
                                       double&nbsp;epsilon,
                                       int&nbsp;maxIterations)</PRE>
<DL>
<DD>Returns the regularized gamma function Q(a, x) = 1 - P(a, x).

 The implementation of this method is based on:
 <ul>
  <li>
   <a href="http://mathworld.wolfram.com/RegularizedGammaFunction.html">
   Regularized Gamma Function</a>, equation (1).
  </li>
  <li>
   <a href="http://functions.wolfram.com/GammaBetaErf/GammaRegularized/10/0003/">
   Regularized incomplete gamma function: Continued fraction representations
   (formula 06.08.10.0003)</a>
  </li>
 </ul>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>a</CODE> - the a parameter.<DD><CODE>x</CODE> - the value.<DD><CODE>epsilon</CODE> - When the absolute value of the nth item in the
 series is less than epsilon the approximation ceases to calculate
 further elements in the series.<DD><CODE>maxIterations</CODE> - Maximum number of "iterations" to complete.
<DT><B>Returns:</B><DD>the regularized gamma function P(a, x)
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/MaxCountExceededException.html" title="class in org.apache.commons.math3.exception">MaxCountExceededException</A></CODE> - if the algorithm fails to converge.</DL>
</DD>
</DL>
<HR>

<A NAME="digamma(double)"><!-- --></A><H3>
digamma</H3>
<PRE>
public static double <B>digamma</B>(double&nbsp;x)</PRE>
<DL>
<DD><p>Computes the digamma function of x.</p>

 <p>This is an independently written implementation of the algorithm described in
 Jose Bernardo, Algorithm AS 103: Psi (Digamma) Function, Applied Statistics, 1976.</p>

 <p>Some of the constants have been changed to increase accuracy at the moderate expense
 of run-time.  The result should be accurate to within 10^-8 absolute tolerance for
 x >= 10^-5 and within 10^-8 relative tolerance for x > 0.</p>

 <p>Performance for large negative values of x will be quite expensive (proportional to
 |x|).  Accuracy for negative values of x should be about 10^-8 absolute for results
 less than 10^5 and 10^-8 relative for results larger than that.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - Argument.
<DT><B>Returns:</B><DD>digamma(x) to within 10-8 relative or absolute error whichever is smaller.<DT><B>Since:</B></DT>
  <DD>2.0</DD>
<DT><B>See Also:</B><DD><a href="http://en.wikipedia.org/wiki/Digamma_function">Digamma</a>, 
<a href="http://www.uv.es/~bernardo/1976AppStatist.pdf">Bernardo&apos;s original article </a></DL>
</DD>
</DL>
<HR>

<A NAME="trigamma(double)"><!-- --></A><H3>
trigamma</H3>
<PRE>
public static double <B>trigamma</B>(double&nbsp;x)</PRE>
<DL>
<DD>Computes the trigamma function of x.
 This function is derived by taking the derivative of the implementation
 of digamma.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - Argument.
<DT><B>Returns:</B><DD>trigamma(x) to within 10-8 relative or absolute error whichever is smaller<DT><B>Since:</B></DT>
  <DD>2.0</DD>
<DT><B>See Also:</B><DD><a href="http://en.wikipedia.org/wiki/Trigamma_function">Trigamma</a>, 
<A HREF="../../../../../org/apache/commons/math3/special/Gamma.html#digamma(double)"><CODE>digamma(double)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="lanczos(double)"><!-- --></A><H3>
lanczos</H3>
<PRE>
public static double <B>lanczos</B>(double&nbsp;x)</PRE>
<DL>
<DD><p>
 Returns the Lanczos approximation used to compute the gamma function.
 The Lanczos approximation is related to the Gamma function by the
 following equation
 <center>
 <code>gamma(x) = sqrt(2 * pi) / x * (x + g + 0.5) ^ (x + 0.5)
                   * exp(-x - g - 0.5) * lanczos(x)</code>,
 </center>
 where <code>g</code> is the Lanczos constant.
 </p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - Argument.
<DT><B>Returns:</B><DD>The Lanczos approximation.<DT><B>Since:</B></DT>
  <DD>3.1</DD>
<DT><B>See Also:</B><DD><a href="http://mathworld.wolfram.com/LanczosApproximation.html">Lanczos Approximation</a>
 equations (1) through (5), and Paul Godfrey's
 <a href="http://my.fit.edu/~gabdo/gamma.txt">Note on the computation
 of the convergent Lanczos complex Gamma approximation</a></DL>
</DD>
</DL>
<HR>

<A NAME="invGamma1pm1(double)"><!-- --></A><H3>
invGamma1pm1</H3>
<PRE>
public static double <B>invGamma1pm1</B>(double&nbsp;x)</PRE>
<DL>
<DD>Returns the value of 1 / &Gamma;(1 + x) - 1 for -0&#46;5 &le; x &le;
 1&#46;5. This implementation is based on the double precision
 implementation in the <em>NSWC Library of Mathematics Subroutines</em>,
 <code>DGAM1</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - Argument.
<DT><B>Returns:</B><DD>The value of <code>1.0 / Gamma(1.0 + x) - 1.0</code>.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/NumberIsTooSmallException.html" title="class in org.apache.commons.math3.exception">NumberIsTooSmallException</A></CODE> - if <code>x &lt; -0.5</code>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/NumberIsTooLargeException.html" title="class in org.apache.commons.math3.exception">NumberIsTooLargeException</A></CODE> - if <code>x &gt; 1.5</code><DT><B>Since:</B></DT>
  <DD>3.1</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="logGamma1p(double)"><!-- --></A><H3>
logGamma1p</H3>
<PRE>
public static double <B>logGamma1p</B>(double&nbsp;x)
                         throws <A HREF="../../../../../org/apache/commons/math3/exception/NumberIsTooSmallException.html" title="class in org.apache.commons.math3.exception">NumberIsTooSmallException</A>,
                                <A HREF="../../../../../org/apache/commons/math3/exception/NumberIsTooLargeException.html" title="class in org.apache.commons.math3.exception">NumberIsTooLargeException</A></PRE>
<DL>
<DD>Returns the value of log &Gamma;(1 + x) for -0&#46;5 &le; x &le; 1&#46;5.
 This implementation is based on the double precision implementation in
 the <em>NSWC Library of Mathematics Subroutines</em>, <code>DGMLN1</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - Argument.
<DT><B>Returns:</B><DD>The value of <code>log(Gamma(1 + x))</code>.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/NumberIsTooSmallException.html" title="class in org.apache.commons.math3.exception">NumberIsTooSmallException</A></CODE> - if <code>x &lt; -0.5</code>.
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/NumberIsTooLargeException.html" title="class in org.apache.commons.math3.exception">NumberIsTooLargeException</A></CODE> - if <code>x &gt; 1.5</code>.<DT><B>Since:</B></DT>
  <DD>3.1</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="gamma(double)"><!-- --></A><H3>
gamma</H3>
<PRE>
public static double <B>gamma</B>(double&nbsp;x)</PRE>
<DL>
<DD>Returns the value of Γ(x). Based on the <em>NSWC Library of
 Mathematics Subroutines</em> double precision implementation,
 <code>DGAMMA</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - Argument.
<DT><B>Returns:</B><DD>the value of <code>Gamma(x)</code>.<DT><B>Since:</B></DT>
  <DD>3.1</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Gamma.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/commons/math3/special/Erf.html" title="class in org.apache.commons.math3.special"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html?org/apache/commons/math3/special/Gamma.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Gamma.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
Copyright &#169; 2003-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>
